package com.meeruu.sg.account.core.api.constant;

import lombok.Getter;

/**
 * @author yangqintao
 * @date 2019-05-16
 * @description: 账户类型
 */
@Getter
public enum AccountGroup {

    USER(1, "用户账户"),
    MERCHANT(2, "商家账户"),
    ORG(3, "机构账户"),

    ;
    private Integer code;
    private String desc;

    AccountGroup(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AccountGroup getByCode(Integer code) {
        if (code.equals(USER.code)) {
            return USER;
        } else if (code.equals(MERCHANT.code)) {
            return MERCHANT;
        } else if (code.equals(ORG.code)) {
            return ORG;
        }
        return null;
    }
}
